package com.scetop.bank;

public class CheckingAccount extends Account{
    private double overdraftProtection;
    public CheckingAccount(double balance){
        super(balance);
    }
    public CheckingAccount(double balance,double protect){
        super(balance);
        this.overdraftProtection = protect;
    }

    @Override
    public boolean withdraw(double amt) {
        if (this.getBalance() + overdraftProtection - amt < 0) {
            System.out.println("余额不足且超出透支保护额度");
            return false;
        } else {
            // 直接调用父类的 setBalance 方法
            setBalance(getBalance() - amt);
            return true;
        }
    }

    public double getOverdraftProtection() {
        return overdraftProtection;
    }
}